﻿// Pipeline Component Library Example
// ----------------------------------
// Colin Bowern (colinbowern@hotmail.com)
// January 2007
//
// Copyright (c) 2007 Colin Bowern
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// * The above copyright notice and this permission notice shall be included in
//   all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#region References
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RockstarGuys.PipelineComponents;
using System;
using System.Collections.Generic;
using System.Text;
#endregion

namespace RockstarGuys.PipelineComponents.Tests
{
    /// <summary>
    ///This is a test class for RockstarGuys.PipelineComponents.CalculateTax and is intended
    ///to contain all RockstarGuys.PipelineComponents.CalculateTax Unit Tests
    ///</summary>
    [TestClass]
    public class CalculateTaxTest
    {
        #region Constructor
        /// <summary>
        /// Positive: Object initialized properly
        ///</summary>
        [TestMethod]
        public void ConstructorTest1()
        {
            CalculateTax target = new CalculateTax();
            Assert.IsNotNull(target);
        }
        #endregion

        #region Execute
        /// <summary>
        /// Positive: Empty order
        ///</summary>
        [TestMethod]
        public void ExecuteTest1()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            PipelineContext pipelineContext = new PipelineContext();
            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: One item, no taxes to apply
        ///</summary>
        [TestMethod]
        public void ExecuteTest2()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "US";
            orderAddress.RegionCode = "WA";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: One item, country taxes to apply
        ///</summary>
        [TestMethod]
        public void ExecuteTest3()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "AB";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.07M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.07M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: One item, country/region taxes apply
        ///</summary>
        [TestMethod]
        public void ExecuteTest4()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.17M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.17M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items, no taxes
        /// </summary>
        [TestMethod]
        public void ExecuteTest5()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "US";
            orderAddress.RegionCode = "WA";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            orderForm.LineItems.Add(lineItem2);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items, country/region taxes apply
        /// </summary>
        [TestMethod]
        public void ExecuteTest6()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            orderForm.LineItems.Add(lineItem2);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.50M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.17M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.33M, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items, mixed set of taxes apply
        /// </summary>
        [TestMethod]
        public void ExecuteTest7()
        {
            CalculateTax target = new CalculateTax();

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            OrderAddress orderAddress2 = new OrderAddress();
            orderAddress2.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress2.CountryCode = "CA";
            orderAddress2.RegionCode = "BC";
            orderForm.Addresses[orderAddress2.OrderAddressId] = orderAddress2;

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress2.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            orderForm.LineItems.Add(lineItem2);

            OrderAddress orderAddress3 = new OrderAddress();
            orderAddress3.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress3.CountryCode = "US";
            orderAddress3.RegionCode = "WA";
            orderForm.Addresses[orderAddress3.OrderAddressId] = orderAddress3;

            LineItem lineItem3 = new LineItem("CATALOG", "PROD002", 1);
            lineItem3.ShippingAddressId = orderAddress3.OrderAddressId;
            lineItem3.ExtendedPrice = 3.45M;
            orderForm.LineItems.Add(lineItem3);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.31M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.17M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.14M, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items, country/region taxes apply, line item country tax exemption
        /// </summary>
        [TestMethod]
        public void ExecuteTest8()
        {
            CalculateTax target = new CalculateTax();

            target.EnableTaxExemptionRules = true;
            target.CountryTaxExemptionKey = "tax_exempt";
            target.CountryTaxExemptionKeySource = CalculateTax.KeySources.LineItem;

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            OrderAddress orderAddress2 = new OrderAddress();
            orderAddress2.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress2.CountryCode = "CA";
            orderAddress2.RegionCode = "BC";
            orderForm.Addresses[orderAddress2.OrderAddressId] = orderAddress2;

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress2.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            lineItem2[target.CountryTaxExemptionKey] = true;
            orderForm.LineItems.Add(lineItem2);

            OrderAddress orderAddress3 = new OrderAddress();
            orderAddress3.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress3.CountryCode = "US";
            orderAddress3.RegionCode = "WA";
            orderForm.Addresses[orderAddress3.OrderAddressId] = orderAddress3;

            LineItem lineItem3 = new LineItem("CATALOG", "PROD002", 1);
            lineItem3.ShippingAddressId = orderAddress3.OrderAddressId;
            lineItem3.ExtendedPrice = 3.45M;
            orderForm.LineItems.Add(lineItem3);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.17M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.17M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items and shipments, country/region taxes apply, line item country tax exemption
        /// </summary>
        [TestMethod]
        public void ExecuteTest9()
        {
            CalculateTax target = new CalculateTax();

            target.EnableTaxExemptionRules = true;
            target.CountryTaxExemptionKey = "tax_exempt";
            target.CountryTaxExemptionKeySource = CalculateTax.KeySources.LineItem;

            OrderForm orderForm = new OrderForm();

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            OrderAddress orderAddress2 = new OrderAddress();
            orderAddress2.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress2.CountryCode = "CA";
            orderAddress2.RegionCode = "BC";
            orderForm.Addresses[orderAddress2.OrderAddressId] = orderAddress2;

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress2.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            lineItem2[target.CountryTaxExemptionKey] = true;
            orderForm.LineItems.Add(lineItem2);

            OrderAddress orderAddress3 = new OrderAddress();
            orderAddress3.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress3.CountryCode = "US";
            orderAddress3.RegionCode = "WA";
            orderForm.Addresses[orderAddress3.OrderAddressId] = orderAddress3;

            LineItem lineItem3 = new LineItem("CATALOG", "PROD002", 1);
            lineItem3.ShippingAddressId = orderAddress3.OrderAddressId;
            lineItem3.ExtendedPrice = 3.45M;
            orderForm.LineItems.Add(lineItem3);

            Shipment shipment = new Shipment();
            shipment.ShippingAddressId = orderAddress2.OrderAddressId;
            shipment.ShippingTotal = 4.56M;
            orderForm.Shipments.Add(shipment);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(0.44M, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.17M, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxIncluded.Value);
            Assert.AreEqual<decimal>(0.27M, orderForm.Shipments[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.Shipments[0].TaxIncluded.Value);
        }

        /// <summary>
        /// Positive: Multiple items and shipments, country/region taxes apply, order level tax exemption
        /// </summary>
        [TestMethod]
        public void ExecuteTest10()
        {
            CalculateTax target = new CalculateTax();

            target.EnableTaxExemptionRules = true;
            target.CountryTaxExemptionKey = "country_tax_exempt";
            target.CountryTaxExemptionKeySource = CalculateTax.KeySources.OrderForm;
            target.RegionTaxExemptionKey = "region_tax_exempt";
            target.RegionTaxExemptionKeySource = CalculateTax.KeySources.OrderForm;

            OrderForm orderForm = new OrderForm();
            orderForm[target.CountryTaxExemptionKey] = true;
            orderForm[target.RegionTaxExemptionKey] = true;

            OrderAddress orderAddress = new OrderAddress();
            orderAddress.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress.CountryCode = "CA";
            orderAddress.RegionCode = "ON";
            orderForm.Addresses[orderAddress.OrderAddressId] = orderAddress;

            LineItem lineItem = new LineItem("CATALOG", "PROD001", 1);
            lineItem.ShippingAddressId = orderAddress.OrderAddressId;
            lineItem.ExtendedPrice = 1.23M;
            orderForm.LineItems.Add(lineItem);

            OrderAddress orderAddress2 = new OrderAddress();
            orderAddress2.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress2.CountryCode = "CA";
            orderAddress2.RegionCode = "BC";
            orderForm.Addresses[orderAddress2.OrderAddressId] = orderAddress2;

            LineItem lineItem2 = new LineItem("CATALOG", "PROD002", 1);
            lineItem2.ShippingAddressId = orderAddress2.OrderAddressId;
            lineItem2.ExtendedPrice = 2.34M;
            orderForm.LineItems.Add(lineItem2);

            OrderAddress orderAddress3 = new OrderAddress();
            orderAddress3.OrderAddressId = Guid.NewGuid().ToString();
            orderAddress3.CountryCode = "US";
            orderAddress3.RegionCode = "WA";
            orderForm.Addresses[orderAddress3.OrderAddressId] = orderAddress3;

            LineItem lineItem3 = new LineItem("CATALOG", "PROD002", 1);
            lineItem3.ShippingAddressId = orderAddress3.OrderAddressId;
            lineItem3.ExtendedPrice = 3.45M;
            orderForm.LineItems.Add(lineItem3);

            Shipment shipment = new Shipment();
            shipment.ShippingAddressId = orderAddress2.OrderAddressId;
            shipment.ShippingTotal = 4.56M;
            orderForm.Shipments.Add(shipment);

            PipelineContext pipelineContext = new PipelineContext();
            pipelineContext.CommerceResources = new CommerceResources("StarterSite");

            int lFlags = 0;
            int expected = (int)ComponentErrorLevel.Success;

            int actual = target.Execute(orderForm.InnerDictionary, pipelineContext.InnerDictionary, lFlags);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[0].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[1].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.LineItems[2].TaxIncluded.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.Shipments[0].TaxTotal.Value);
            Assert.AreEqual<decimal>(decimal.Zero, orderForm.Shipments[0].TaxIncluded.Value);
        }
        #endregion
    }
}
